package com.xiaoxin.service;

import com.xiaoxin.dubbo.api.UserLocationApi;
import com.xiaoxin.exception.BusinessException;
import com.xiaoxin.interceptor.UserHolder;
import com.xiaoxin.model.vo.ErrorResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author xiaoxiaode
 * @date 2021-09-10-14:55
 **/
@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    /**
      * @Param: 经纬度/地址
      * @Return: null
      * @Description: 修改/保存地理位置
     **/
    public void updateLocation(Double longitude, Double latitude, String address) {
        Boolean boo=userLocationApi.updateLocation(UserHolder.getId(),longitude,latitude,address);
        if(!boo){
            throw new BusinessException(ErrorResult.error());
        }
    }
}
